//
//  TextCoreView.m
//  SHRCWDemo
//
//  Created by 01 on 17/2/18.
//  Copyright © 2017年 蔡正军. All rights reserved.
//

#import "TextCoreView.h"

@implementation TextCoreView

-(void)setFrameRef:(CTFrameRef)frameRef
{
    if (_frameRef != frameRef) {
        if (_frameRef) {
            CFRelease(_frameRef);
            _frameRef = nil;
        }
        _frameRef = frameRef;
    }
}

-(void)drawRect:(CGRect)rect
{
    if (!_frameRef) {
        return;
    }
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextSetTextMatrix(ctx, CGAffineTransformIdentity);
    CGContextTranslateCTM(ctx, 0, self.bounds.size.height);
    CGContextScaleCTM(ctx, 1.0, -1.0);
    CTFrameDraw(_frameRef, ctx);

}
@end
